﻿@model IEnumerable<wUniApp.MVC.App_Data.InheritanceProcedure>

@{
    ViewBag.Title = wUniApp.MVC.App_GlobalResources.Resources.Index;
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<script>
  app.controller('wPBIT_Ctrl', function ($scope, $http) {
    var resultPromise = $http.get("/InheritanceProcedures/IndexJS");
    resultPromise.success(function (data) {
      $scope.myData = data;
    });

    $scope.gridOptions = {
      data: 'myData',
      columnDefs: [
        { field: 'name', displayName: '@wUniApp.MVC.App_GlobalResources.Resources.FirstName' },
        { field: 'description', displayName: '@wUniApp.MVC.App_GlobalResources.Resources.Description' },
        { field: 'amount', displayName: '@wUniApp.MVC.App_GlobalResources.Resources.Amount' }]
    };
  });
</script>
@Html.GetTitle()


<h4 style="background:#cedce8;padding:10px">Angular.js binding & ng-grid</h4>
<div class="gridStyle" ng-grid="gridOptions"></div>
<hr/>
<p>
    @Html.CreateNew()
</p>
<table class="table">
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.Customer.FirstName)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.Description)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.AmountDue)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Customer.FirstName)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Description)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.AmountDue)
        </td>
        <td>
          @Html.EDDButtons(item.Id)
        </td>
    </tr>
}

</table>
